import excel2json from '@feidao/web/atom/nodejs/report/excel2json';
import log from "@feidao/web/atom/nodejs/logger/log";

interface Message {
	str: string;
}

export default async function atom(msg: Message, action_id: string, session_id: string) {
	log('日志开始，导入数据');
	const jd = excel2json(msg.str);
	log('转换后的excel数据', JSON.stringify(jd));
	// 获取到的数据为二维数组，表格中的第一行，在转换后的对象数组中为key，第二行则为数据

	// 一个页签
	// [[{"a":"e","b":"f","c":"g","d":"h"}]]

	// 两个页签
	// [[{"y":"j","u":"k","I":"l","o":";"}],[{"a":"e","b":"f","c":"g","d":"h"}]]

	// 三个页签
	// [[{"y":"j","u":"k","I":"l","o":";"}],[{"a":"e","b":"f","c":"g","d":"h"}],[{"3":7,"4":8,"5":9,"6":0}]]

	// 页签的顺序，决定了数据在二维数组中的顺序
	return true;
}
